<%@ page import="javax.xml.crypto.Data" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>

<head>
    <base href="<%=basePath%>">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="css/base.css">
    <link rel="stylesheet" type="text/css" href="css/index.css">
    <link rel="stylesheet" type="text/css" href="css/sendnew.css">
    <script src="static/js/jquery-1.11.0.min.js"></script>
    <title>发帖</title>
    <script src="static/js/base.js"></script>
</head>
<body>
<%@include file="header.jsp"%>
<%request.setCharacterEncoding("utf-8");%>
<%@include file="user_menubar.jsp"%>
<script type="text/javascript">
    $(function () {
        initFatherAndChild();
        $("#father_block").change(function () {
           var fatherSid =$("#father_block").val();
            getChild(fatherSid);
        });
    });
    function initFatherAndChild() {
        var firstFatherBlockSid;
        $.get("/class_design/findAjax", {method:"initFather"},function (data, status) {
            $.each(data, function (i, d) {
                $("#father_block").append(
                    "<option value='" + d.sid + "'>" + d.sName + "</option>"
                )
            });
            firstFatherBlockSid = data[0].sid;
            getChild(firstFatherBlockSid);

        }, 'json');
    }
    function getChild(firstFatherBlockSid) {
        $.get("/class_design/findAjax", {method:"getChild",sId: firstFatherBlockSid}, function (data, status) {
            $("#child_block").empty();
            $.each(data, function (i, d) {
                $("#child_block").append(
                    "<option value='" + d.sid + "'>"+ d.sName +"</option>"
                )
            });

        }, 'json');
    }
</script>
<div class="container">
    <%if (request.getSession().getAttribute("user") != null) {%>

    <form action="/class_design/sendtopic.jhtml" method="post" name="sendForm" >
        <div class="main"style="border: #eef0f3 1px solid; margin-top: -1950px;width: 1270px;margin-left:-150px">
            <div class="title">
                <h2><span>发布</span> </h2>
                <ul>
                    <li class="post select">帖子</li>
                </ul>
            </div>

            <div class="rtc">
                <div class="rtc-title">
                    <h3 class="t">帖子标题：</h3>

                    <div>
                        <input type="text" name="send_title">
                    </div>
                </div>
            </div>

            <div class="post-body">
                <h3 class="t">帖子内容：</h3>
                <div class="am-form">
                    <div class="am-form-group cmt-group">
                        <textarea class="ta-cmt" rows="16" name="send_content" style="width: 1200px;height: 400px;"></textarea>
                    </div>
                </div>
            </div>

            <!--分类下拉菜单-->
            <div class="cate t">
                <h3>选择分类：</h3>

                <select data-am-selected="{dropUp: 1}" id="father_block" name="father_block"></select>
                <select data-am-selected="{dropUp: 1}" id="child_block" name="child_block"></select>
            </div>

            <div class="pub">
                <button class="am-btn am-btn-success am-btn-sm am-radius" type="submit"> 发 布 </button>
            </div>
        </div>
    </form>
        <div class="info">
            <div class="guide t">
                <h3>帖子发起指南</h3>
                <p>
                    <strong>• 帖子标题:</strong>
                    请用准确的语言描述您发布的帖子思想
                </p>
                <p>
                    <strong>• 帖子内容:</strong>
                    详细补充您的帖子内容, 并提供一些相关的素材以供参与者更多的了解您所写帖子的主题思想
                </p>
                <p>
                    <strong>• 选择分类:</strong>
                    选择一个合适的版块, 让您发布的帖子得到更多有相同兴趣的人参与
                </p>
            </div>

        </div>
    <%} else {%>
    <h3>请先<a href="user_login.jsp">登录</a></h3>
    <%}%>
</div>
<%@include file="footer.jsp"%>
</body>

</html>
